<script>
export default {
  name:'UploadQue',
  data() {
    return {
      my_file: [],
      headers: {
        'Authorization' : sessionStorage.getItem('token')
      }
    };
  },
  methods: {
    handleRemove(file, my_file) {
      console.log(file, my_file);
    },
    handlePreview(file) {
      console.log(file);
    },
    handleExceed(files, my_file) {
      // this.$message.warning(`当前限制选择 3 个文件，本次选择了 ${files.length} 个文件，共选择了 ${files.length + my_file.length} 个文件`);
    },
    beforeRemove(file, my_file) {
      return this.$confirm(`确定移除 ${ file.name }？`);
    }
  }
}
</script>

<template>
  <div>

    <el-upload
        class="upload-demo"
        :headers="headers"
        name="my_file"
        action="http://8.152.4.101:9999/files/upload_file"
        :on-preview="handlePreview"
        :on-remove="handleRemove"
        :before-remove="beforeRemove"
         multiple
        :on-exceed="handleExceed"
        :file-list="my_file">
      <el-button size="small" type="primary">点击上传</el-button>
      <div slot="tip" class="el-upload__tip">只能上传jpg/png文件，且不超过500kb</div>
    </el-upload>
    <!-- <el-upload
        class="upload-demo"
        :headers="headers"
        name="my_file"
        action="http://localhost/files/upload_file"
        :on-preview="handlePreview"
        :on-remove="handleRemove"
        :before-remove="beforeRemove"
         multiple
        :on-exceed="handleExceed"
        :file-list="my_file">
      <el-button size="small" type="primary">点击上传</el-button>
      <div slot="tip" class="el-upload__tip">只能上传jpg/png文件，且不超过500kb</div>
    </el-upload> -->

  </div>
</template>

<style scoped>

</style>